package com.his.controller;


import com.his.entity.DiagnosisCatalog;
import com.his.entity.ResponseResult;
import com.his.entity.Staff;
import com.his.service.IDiagnosisCatalogService;
import com.his.service.IStaffService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 诊断类型（疾病）目录表 前端控制器
 * </p>
 *
 * @author Demoon Liu
 * @since 2022-02-20
 */
@Tag(name="DiagnosisCatalogController--诊断目录管理接口")
@RestController
@RequestMapping("/diagnosis-catalog")
public class DiagnosisCatalogController {
    @Resource
    public IDiagnosisCatalogService diagnosisCatalogService;

    @Operation(summary = "添加诊断目录",description ="输入：diagnosisCatalog（除id外所有信息）。 返回：一个diagnosisCatalog信息 ")
    @PostMapping("/add")
    public ResponseResult addDiagCat(@RequestBody DiagnosisCatalog diagnosisCatalog){
        return diagnosisCatalogService.addCat(diagnosisCatalog);
    }

    @Operation(summary = "删除诊断目录",description ="输入：id。 返回：无 ")
    @PostMapping("/delete")
    public ResponseResult deleteDiagCat(@RequestBody long id){
        return diagnosisCatalogService.deleteCat(id);
    }

    @Operation(summary = "更新诊断目录",description ="输入：diagnosisCatalog（除id外所有信息）。 返回：一个diagnosisCatalog信息 ")
    @PostMapping("/update")
    public ResponseResult updateDiagCat(@RequestBody DiagnosisCatalog diagnosisCatalog){
        return diagnosisCatalogService.updateCat(diagnosisCatalog);
    }

    @Operation(summary = "查找所有诊断目录",description ="输入：无。 返回：多个diagnosisCatalog信息 ")
    @PostMapping("/selectall")
    public ResponseResult selectAllDiagCat(){
        return diagnosisCatalogService.selectAll();
    }

    @Operation(summary = "模糊查询诊断目录",description ="输入：String类型的（name）。 返回：多个diagnosisCatalog信息 ")
    @PostMapping("/selectlike")
    public ResponseResult selectLikeCat(@RequestBody String str){ return diagnosisCatalogService.selectCat(str); }

}
